package map;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import block.Blocks;

public class FlatMapCreatorInfo {
	private final List<FlatChunkStratumInfo> stratums = new ArrayList<FlatChunkStratumInfo>();

	public List<FlatChunkStratumInfo> getstratums() {
		return this.stratums;
	}

	public void calculatMinY() {
		int i = 0;
		FlatChunkStratumInfo flatlayerinfo;

		for (Iterator<FlatChunkStratumInfo> iterator = this.stratums.iterator(); iterator.hasNext(); i += flatlayerinfo.getCount()) {
			flatlayerinfo = (FlatChunkStratumInfo) iterator.next();
			flatlayerinfo.setMinY(i);
		}
	}

	public String toString() {
		StringBuilder stringbuilder = new StringBuilder();
		stringbuilder.append(2);
		stringbuilder.append(";");
		int i;

		for (i = 0; i < this.stratums.size(); ++i) {
			if (i > 0) {
				stringbuilder.append(",");
			}

			stringbuilder.append((this.stratums.get(i)).toString());
		}

		stringbuilder.append(";");

		return stringbuilder.toString();
	}

	public static FlatMapCreatorInfo getDefault() {
		FlatMapCreatorInfo flatgeneratorinfo = new FlatMapCreatorInfo();
		flatgeneratorinfo.getstratums().add(new FlatChunkStratumInfo(1, Blocks.STONE.getID()));
		flatgeneratorinfo.getstratums().add(new FlatChunkStratumInfo(2, Blocks.STONE.getID()));
		flatgeneratorinfo.getstratums().add(new FlatChunkStratumInfo(1, Blocks.DIRT.getID()));
		flatgeneratorinfo.calculatMinY();
		return flatgeneratorinfo;
	}
}
